- signature = local_assigns.fetch(:signature)
- title = local_assigns.fetch(:title)
- description = local_assigns.fetch(:description, nil)
- label = local_assigns.fetch(:label)
- variant = local_assigns.fetch(:variant)
- icon = local_assigns.fetch(:icon, nil)

- title = capture do
  .signature-popover
    %div
      %strong
        = title

      %p.gl-my-3
        = description

- content = capture do
  - if signature.nil?
    = _('Unsupported signature')
  - elsif signature.x509?
    = render partial: "projects/commit/x509/certificate_details", locals: { signature: signature }

    = link_to(_('Learn more about X.509 signed commits'), help_page_path('user/project/repository/signed_commits/x509.md'), class: 'gl-link gl-block')
  - elsif signature.ssh?
    = _('SSH key fingerprint:')
    %span.gl-font-monospace= signature.key_fingerprint_sha256 || _('Unknown')

    = link_to(_('Learn about signing commits with SSH keys.'), help_page_path('user/project/repository/signed_commits/ssh.md'), class: 'gl-link gl-block gl-mt-3')
  - else
    = _('GPG Key ID:')
    %span.gl-font-monospace= signature.gpg_key_primary_keyid

    = link_to(_('Learn about signing commits'), help_page_path('user/project/repository/signed_commits/_index.md'), class: 'gl-link gl-block gl-mt-3')
= gl_badge_tag(label, { variant: variant, icon: icon, href: '#' }, { class: 'signature-badge gl-inline-flex gl-align-middle', role: 'button', tabindex: 0, data: { toggle: 'popover', html: 'true', triggers: 'click blur', placement: 'bottom', title: title, content: content} })
